import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.jfinal.handler.Handler;

public class BaseHandler extends Handler {
    @Override
    public void handle(String target, HttpServletRequest request,
            HttpServletResponse response, boolean[] isHandled) {
         
        //如果路径中包含HouTai(该路径下所有资源),那么验证身份,通过验证才能进入后台管理模块
        if(target.indexOf("HouTai")>0){
            HttpSession session = request.getSession(false);
            if(session==null||session.getAttribute("user")==null){              
            //验证不成功，跳转到后台登陆页面
                target="/HouTai/index";
            }
        }
        nextHandler.handle(target, request, response, isHandled);
    }
}
